package runtime.test;

import java.util.Date;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.demo2do.core.utils.JsonUtils;
import com.demo2do.core.web.support.HttpResult;
import co.fitstart.api.handler.WxcClientOrderHandler;
import co.fitstart.entity.order.Order;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:/api/applicationContext-*.xml", "classpath*:/api/dev/applicationContext-*.xml" })
public class JunitTestMain {
    
    private static final Logger logger = LoggerFactory.getLogger(JunitTestMain.class);
    
    @Autowired
    private WxcClientOrderHandler wxcClientOrderHandler;
    
    @Test
    public void wxcSalesOrderCreate() {
        Order order = new Order();
        order.setPayTime(new Date());
        order.setAmount(new Integer(1));
        order.setPrice(new Integer(100));
        order.setCode("fitstart_test" + new Date().getTime());
        HttpResult httpResult = wxcClientOrderHandler.create(order);
        logger.info("get final result [{}]", JsonUtils.toJsonString(httpResult));
    }
    
}
